// Enum with integer data stored in an instance field
package org.effectivejava.examples.chapter06.item31;

/**
 * 十二重奏，用实例域代替序号（ordinal()方法）
 */
public enum Ensemble {
	SOLO(1), DUET(2), TRIO(3), QUARTET(4), QUINTET(5),
	SEXTET(6), SEPTET(7), OCTET(8), DOUBLE_QUARTET(8), NONET(9), DECTET(10),
	TRIPLE_QUARTET(12);

	private final int numberOfMusicians;

	Ensemble(int size) {
		this.numberOfMusicians = size;
	}

	public int numberOfMusicians() {
		return numberOfMusicians;
	}

	// 不推荐这种方法
	public int numberMusicians() {
		return ordinal() + 1;
	}
}
